package com.xiaoshuidi.cloud.module.bpm.enums.swo;

import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 维修工单服务类型枚举
 */
@Getter
@AllArgsConstructor
public enum SwoTicketRepairTypeEnum {

    HOUSE_LEAKAGE("房屋渗漏维修", 1),
    HARDWARE_SANITARY_WARE("五金洁具更换维修", 2),
    WATERWAY_CIRCUIT("水路/电路维修", 3),
    DOOR_AND_WINDOW_LOCKS("门窗锁具维修", 4),
    WALL_AND_FLOOR("墙地面维修", 5),
    PIPELINE("管道疏通", 6),
    FURNITURE("家具维修", 7),
    OTHER("其他", 8);

    private final String name;
    private final Integer value;

    public static String getNameByValue(Integer value){
        SwoTicketRepairTypeEnum swoTicketRepairTypeEnum = Arrays.stream(SwoTicketRepairTypeEnum.values()).filter(p -> p.getValue().equals(value)).findFirst().orElse(null);
        if(ObjectUtil.isEmpty(swoTicketRepairTypeEnum)){
            return "";
        }
        return swoTicketRepairTypeEnum.getName();
    }
}
